package com.bdqn.util;

import com.bdqn.pojo.Equip;
import com.bdqn.pojo.Player;
import com.bdqn.pojo.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

//上机测试类
public class Test {
    @org.junit.Test
    public void testLesson5(){
        ApplicationContext conetext = new ClassPathXmlApplicationContext("applicationContext.xml");
        User ma = (User)conetext.getBean("mawangye");
        User lu = (User) conetext.getBean("luxun");
        ma.Say();
        lu.Say();
    }

    //课后测试类
    @org.junit.Test
    public void testToukui(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Equip toukui = (Equip)context.getBean("toukui");
        System.out.println("装备:"+toukui.getName()+"[速度增效:"+toukui.getSpeedPlus()+";攻击增效:"+
                toukui.getAttackPlus()+";防御增效:"+toukui.getDefencePlus()+"]"
        );
    }
    @org.junit.Test
    public void testShangyi(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Equip shagyi = (Equip)context.getBean("shagyi");
        System.out.println("装备:"+shagyi.getName()+"[速度增效:"+shagyi.getSpeedPlus()+";攻击增效:"+
                shagyi.getAttackPlus()+";防御增效:"+shagyi.getDefencePlus()+"]"
        );
    }
    @org.junit.Test
    public void testXiezi(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Equip xiezi = (Equip)context.getBean("xiezi");
        System.out.println("装备:"+xiezi.getName()+"[速度增效:"+xiezi.getSpeedPlus()+";攻击增效:"+
                xiezi.getAttackPlus()+";防御增效:"+xiezi.getDefencePlus()+"]"
        );
    }
    @org.junit.Test
    public void testZhihuan(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Player player = (Player) context.getBean("ssfd");
        player.updateEquip(player.getRing());
        System.out.println(player.getRing().getName());
        Equip zhihuan = (Equip)context.getBean("zhihuan");
        System.out.println("装备:"+zhihuan.getName()+"[速度增效:"+zhihuan.getSpeedPlus()+";攻击增效:"+
                zhihuan.getAttackPlus()+";防御增效:"+zhihuan.getDefencePlus()+"]"
        );
    }

}
